import fetch from 'utils/fetch';
import { SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG } from 'constants';
/**
 * 学校管理
 */

// 2. 服务种类接口
export function listCategoryServiceData() {
    return fetch({
        url: '/category/listCategoryServiceData',
        method: 'post'
    });
}

// 3. 订单统计
export function getOrderStatisticUp(createDate) {
    const data = {
        createDate
    };
    return fetch({
        url: '/serviceOrder/getOrderStatisticUp',
        method: 'post',
        data
    });
}

// 4. 订单统计（账户余额接口）
export function getAgentAccountInfo() {
    return fetch({
        url: '/serviceOrder/getAgentAccountInfo',
        method: 'post'
    });
}

// 5. 订单统计（服务信息接口）
export function listOrderStatisticUp(createDate) {
    const data = {
        createDate
    }
    return fetch({
        url: '/serviceOrder/listOrderStatisticUp',
        method: 'post',
        data
    });
}

// 6. 订单统计（销售额增长趋势图接口）
export function listOrderStatisticChart() {
    return fetch({
        url: '/serviceOrder/listOrderStatisticChart',
        method: 'post'
    });
}

// 7. 学校名称接口
export function listSchoolAllInfo(schoolName) {
    const data = {
        schoolName
    }
    return fetch({
        url: '/serviceOrder/listSchoolAllInfo',
        method: 'post',
        data
    });
}

// 8. 学校统计接口
export function listSchoolStatistic(schoolId, createDate, page, rows) {
    const data = {
        schoolId,
        createDate,
        page,
        rows
    }
    return fetch({
        url: '/serviceOrder/listSchoolStatistic',
        method: 'post',
        data
    });
}

// 9. 订单明细接口
export function listCategoryBySchool(schoolId, createDate) {
    const data = {
        schoolId,
        createDate
    }
    return fetch({
        url: `/serviceOrder/listCategoryBySchool?schoolId=${schoolId}&createDate=${createDate}`,
        method: 'post',
        data
    });
}

// 10. 订单明细接口
export function listOrderDetail(schoolId, classId, incrementId, createDate, phone, page, rows) {
    const data = {
        schoolId,
        classId,
        incrementId,
        createDate,
        phone,
        page,
        rows
    }
    return fetch({
        url: '/serviceOrder/listOrderDetail',
        method: 'post',
        data
    });
}

// 11. 订单明细导出接口
export function exportOrderDetailData(schoolName, classId, incrementId, createDate, AccessToken) {
    const params = {
        schoolName,
        classId,
        incrementId,
        createDate,
        AccessToken
    }
    return fetch({
        url: '/serviceOrder/exportOrderDetailData',
        method: 'get',
        params
    });
}


// 12. 班级接口
export function listClassInfoBySchoolId(schoolId) {
    const data = {
        schoolId
    }
    return fetch({
        url: `/serviceOrder/listClassInfoBySchoolId/${schoolId}`,
        method: 'post',
        data
    });
}
// 19. 商品名称接口
export function listAllServiceType() {
    return fetch({
        url: '/category/listAllServiceType',
        method: 'post'
    });
}

// 13. 服务配置列表接口
export function listPayRecordSchool(schoolId, page, rows) {
    const data = {
        schoolId,
        page,
        rows
    }
    return fetch({
        url: '/configuration/listPayRecordSchool',
        method: 'post',
        data
    });
}

// 14. 服务配置列表下学校服务信息接口
export function listServiceInfoById(schoolId) {
    const data = {
        schoolId
    }
    return fetch({
        url: `/configuration/listServiceInfoById/${schoolId}`,
        method: 'post',
        data
    });
}

// 17. 服务配置下服务查看接口
export function getPayRecordInfoById(pId) {
    const data = {
        pId
    }
    return fetch({
        url: `/configuration/getPayRecordInfoById/${pId}`,
        method: 'post',
        data
    });
}

// 15. 服务配置下服务开通接口
export function saveServiceConfig(schoolId, schoolName, serviceId, serviceName, payType, money, payStartTime, timeNums, orgUserId,isPack,packTimeNums) {
    const data = {
        schoolId,
        schoolName,
        serviceId,
        serviceName,
        payType,
        money,
        payStartTime,
        timeNums,
        orgUserId,
        isPack,
        packTimeNums
    }
    return fetch({
        url: '/configuration/saveServiceConfig',
        method: 'post',
        data
    });
}

// 16. 服务配置下服务修改接口
export function updateServiceConfig(schoolId, pId, payType, money, payStartTime, timeNums, serviceId, reApply,isPack,packTimeNums) {
    const data = {
        schoolId,
        pId,
        payType,
        money,
        payStartTime,
        timeNums,
        serviceId,
        reApply,
        isPack,
        packTimeNums
    }
    return fetch({
        url: '/configuration/updateServiceConfig',
        method: 'post',
        data
    });
}

// 18. 服务种类收费方式接口
export function listAllPayType() {
    return fetch({
        url: '/category/listAllPayType',
        method: 'post'
    });
}

// 获取收费范围
export function getScopeAmount() {
    return fetch({
        url: '/configuration/getScopeAmount',
        method: 'post'
    });
}

//查看当前的增值服务是否可以与会员打包购买

export function getProductIsPack(serviceId){
    const data = {
        serviceId
    }
    return fetch({
        url: '/configuration/getProductIsPack',
        method: 'post',
        data
    });
}

//查看会员收费设置

export function getchargeSetting(){
    return fetch({
        url: '/configuration/getchargeSetting',
        method: 'post'
    });
}